package BehaviorDesignPattern.MediatorPattern;

public class TestMediatorPattern {
    public static void main(String[] args) {
        ConcreteMediator mediator = new ConcreteMediator();

        Component1 component1 = new Component1(mediator);
        Component2 component2 = new Component2(mediator);

        mediator.setComponent1(component1);
        mediator.setComponent2(component2);

        System.out.println("客户端触发操作A。");
        component1.doA();

        System.out.println("==============================");

        System.out.println("客户端触发操作B。");
        component2.doB();
    }
}
